const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('act_id_membership', {
    userId: {
      type: DataTypes.STRING(64),
      allowNull: false,
      primaryKey: true,
      references: {
        model: 'act_id_user',
        key: 'id_'
      },
      field: 'USER_ID_'
    },
    groupId: {
      type: DataTypes.STRING(64),
      allowNull: false,
      primaryKey: true,
      references: {
        model: 'act_id_group',
        key: 'id_'
      },
      field: 'GROUP_ID_'
    }
  }, {
    sequelize,
    tableName: 'act_id_membership',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "USER_ID_" },
          { name: "GROUP_ID_" },
        ]
      },
      {
        name: "ACT_FK_MEMB_GROUP",
        using: "BTREE",
        fields: [
          { name: "GROUP_ID_" },
        ]
      },
    ]
  });
};
